{% extends "base.html" %}

{% block body_class_name %}authorize{% endblock %}

{% block container %}

<div class="subhead">
  <div class="container">
    <h2 class="heading">登录</h2>
  </div>
</div>

<div class="content">
  <div class="container">
    <div class="auth-container">
      <a href="https://github.com/login/oauth/authorize?client_id=63bbd038b8591356a841" class="btn github-btn btn-success"><i class="icon-github"></i>使用 GitHub 账户登录</a>
      <div class="divider"><span>或</span></div>
      {% if error %}
      <div class="alert alert-warning">
        <a data-dismiss="alert" class="close"><i class="icon-remove"></i></a>
        <p><strong>出错了！</strong> {{ error }}</p>
      </div>
      {% endif %}
      <form method="post" class="form">
        <fieldset>
          {% csrf_token %}
          {{ loginForm.email }}
          <input type="password" maxlength="64" name="unencryptPassword" id="unencryptPassword" placeholder="密码">
          <span class="hide">{{ loginForm.password }}</span>
          <label class="checkbox">{{ loginForm.rememberme }} 下次自动登录</label>
          <button id="loginSubmit" class="btn btn-primary" type="submit">登录</button>
        </fieldset>
      </form>
      <p><a href="/resetpassword/">找回密码</a></p>
    </div>{# auth-container #}
  </div>{# container #}
</div>{# content #}

{% endblock %}

{% block js %}
<script>
  $(function(){
    $('#email').attr('placeholder', "邮箱");
    var md5_user_passwd = function() {
      $('#password').val(window.md5($('#unencryptPassword').val()));
    };
    $('#loginSubmit').on('click', md5_user_passwd);
    $('#githubLogo').mouseover(function(){
      $('#viaGitshellFirst').show();
    });
  });
</script>
{% endblock %}
